<#import "/spring.ftl" as spring />
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${Request.language}" lang="${Request.language}">
<head>
	<title><@spring.message 'survey.title'/></title>

	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8;no-cache"/>

	<link rel="shortcut icon" href="${Request.contextPath}/favicon.ico">
	<link rel="stylesheet" type="text/css" href="${Request.contextPath}/css/reset-min.css"/>
	<link rel="stylesheet" type="text/css" href="${Request.contextPath}/ext/resources/css/ext-all.css"/>
	<link rel="stylesheet" type="text/css" href="${Request.contextPath}/ext/resources/css/xtheme-gray-min.css"/>
	<link rel="stylesheet" type="text/css" href="${Request.contextPath}/css/survey-min.css"/>



	<script type="text/javascript">
		var CONTEXT_PATH = "${Request.contextPath}";
		var LANGUAGE = "${Request.language}";
		var SURVEY = {
		id: ${survey.id?c},
		code: '${survey.code}',
		title: '${survey.title?js_string}',
		organization: { id: ${survey.organization.id}, name: '${survey.organization.name?js_string}' },
		questions: [<#list questions as q> {
			id_area: ${q['id_area']!0?c},
			area_code: '${q['area_code']!""}',
			area_description: '${q['area_description']!""?js_string}',
			id_organization: ${q['id_organization']!0?c},
			id_path: ${q['id_path']!0?c},
			path_code: '${q['path_code']!""}',
			path_description: '${q['path_description']!""?js_string}',
			id_unit: ${q['id_unit']!0?c},
			unit_code: '${q['unit_code']!""}',
			unit_name: '${q['unit_name'!""]?js_string}',
			unit_description: '${q['unit_description'!""]?js_string}',
			id_question: ${q['id_question'!0]?c},
			question_code: '${q['question_code']!""}',
			question_description: '${q['question_description']!""?js_string}',
			id_survey: ${q['id_survey']!0?c}
		}<#if (q_has_next)>,</#if></#list>]
	};
	</script>



	<#-- ENDLIBS -->
</head>
<body>
<div id="loading-mask" style="width:100%;height:100%;background:#c3daf9;position:absolute;z-index:20000;left:0;top:0;"> </div>
<div id="loading">
	<div class="loading-indicator">
		<@spring.message 'loading'/>
	</div>
</div>
</div>
<div class="page">
	<div class="content">
		<div id="survey-panel"></div>
		<div id="survey-intro" class="invisible"> <#include 'survey-intro.ftl' > </div>
		<div id="survey-help" class="invisible"> <#include 'survey-help.ftl' > </div>
	</div>
</div>

<#-- ExtJs libraries -->
<#if (debug?? || RequestParameters.debug??)>
<#assign suffix=""/>
<script type="text/javascript" src="${Request.contextPath}/ext/source/core/Ext.js"></script>
<script type="text/javascript" src="${Request.contextPath}/ext/source/adapter/ext-base.js"></script>
<script type="text/javascript" src="${Request.contextPath}/ext/ext-all-debug.js"></script>
<#else>
<#assign suffix="-min"/>
<script type="text/javascript" src="${Request.contextPath}/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="${Request.contextPath}/ext/ext-all.js"></script>
</#if>

<script type="text/javascript" src="${Request.contextPath}/ux/notification${suffix}.js"></script>
<script type="text/javascript" src="${Request.contextPath}/messages-${Request.language}${suffix}.js"></script>
<script type="text/javascript" src="${Request.contextPath}/common${suffix}.js"></script>
<script type="text/javascript" src="${Request.contextPath}/survey${suffix}.js"></script>
<script type="text/javascript" src="${Request.contextPath}/ext/source/locale/ext-lang-${Request.language}${suffix}.js"></script>

<script language="javascript">
	Ext.onReady(Survey.app.init, Survey.app, true);
</script>

</body>
</html>